package com.cswangdao.controller.admin;

import com.cswangdao.domain.vo.StatGoods;
import com.cswangdao.domain.vo.StatOrders;
import com.cswangdao.domain.vo.StatUsers;
import com.cswangdao.result.Result;
import com.cswangdao.service.StatisticService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RequestMapping("/admin/stat")
@Slf4j
@RestController
public class AdminStatController {

    @Autowired
    private StatisticService statisticService;

    @GetMapping("/user")
    public Result<StatUsers> user() {
        log.info("统计每日用户新增数量");
        StatUsers statUsers = statisticService.statUsers();
        return Result.success(statUsers);
    }

    @GetMapping("/order")
    private Result<StatOrders> order() {
        log.info("统计每日订单数量");
        StatOrders statOrders = statisticService.statOrders();
        return Result.success(statOrders);
    }

    @GetMapping("/goods")
    private Result<StatGoods> goods() {
        log.info("统计每日商品销售数量");
        StatGoods statGoods = statisticService.statGoods();
        return Result.success(statGoods);
    }
}
